/**
 * 
 */
package com.googlecode.bestpaper.output.pdf.book;

import com.googlecode.bestpaper.output.pdf.PDFHelper;
import com.googlecode.bestpaper.syntax.book.BPParagraph;
import com.lowagie.text.Font;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Section;

/**
 * @author xalinx at gmail dot com
 * @date Dec 3, 2009
 */
public class PDFParagraph extends BPParagraph<Object, Paragraph> {

	/**
	 * @param content
	 */
	public PDFParagraph(String content) {
		super(content);
	}
	
	public PDFParagraph(){
		
	}

	@Override
	protected Paragraph buildSelf(Object ele, int fontStyle) throws Exception {
		Font font = PDFHelper.getCNFont();
		Paragraph p = new Paragraph(getContent(), font);
		if (ele instanceof Section) {
			((Section)ele).add(p);
		} else if(ele instanceof Paragraph) {
			((Paragraph)ele).add(p);
		}
		return p;
	}

}
